<?php

//类型属性模型
class AttrModel extends Model{
	public $table='attr';
	
	//自动验证表单中的内容
	public $validate=array(
	   array('taname','nonull','属性名不能为空',2,3),
	   array('tavalue','nonull','属性值不能为空',2,3)
	);
	
	public function attrAdd(){
		//调用自动验证
		if(!$this->create()){
			return false;
		}
		
		if(IS_POST){
			$tid=Q('post.tid');
			$taname=Q('post.taname');
			$tavalue=Q('post.tavalue');
			$class=Q('post.class');
			$str=array(
			   'taname' => $taname,
			   'tavalue' => $tavalue,
			   'class' => $class,
			   'tid' => $tid,
			   'type_tid' => $tid
			);
			$this->add($str);
		}
		
		return true;
	}
	
	
	
}



?>